import {v4 as uuidv4} from 'uuid';
//随机生成一个字符串，且不可发生变化，持久存储
export const getUUID=()=>{
    //先从本地存储获取uuid
    let uuid_token=localStorage.getItem('UUIDTOKEN');
    //如果没有
    if(!uuid_token){
        //生成一个
        uuid_token=uuidv4();
        //本地存储一次
        localStorage.setItem('UUIDTOKEN',uuid_token)
    }
    return uuid_token;
}